const app = getApp()
const promisify = require("../../utils/promisify")

Page({
  data: {
    activityId: undefined,
    organizationId: undefined,
    activityImg: "",
    host: "",
    plcae: "",
    breif: [],
    time: "",
    detail: []
  },
  onLoad: function (options) {
    let that = this
    that.setData({
      activityId: options.activityId
    })
    promisify(wx.request)({
      url: `https://www.lional.club:6001/lecture/` + options.activityId + `.json`,
      method: "GET",
      header: {
        'Content-Type': 'application/json' // 默认值
      }
    }).then(
      data => {
        data = data.data
        that.setData({
          activityName: data.activityName,
          activityImg: data.activityImg,
          host: data.host,
          brief: data.brief,
          time: data.time,
          detail: data.detail,
          place: data.place
        })
      }
    )
  },
  preview: function (e) {
    let that = this
    let current = e.target.dataset.url
    let urls = [current]
    console.log(current)
    wx.previewImage({
      current: current,
      urls: urls
    })
  }
})